From a1c8d5f96c7f0b3b2a2e1fa7f9b62d9b8cdaa8f0 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 3 Jun 2015 12:29:55 +1000 Subject: [PATCH] Fix snapshot downloading on Python 3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This regression, introduced in d3f590f59ff72f1d3b457ed3716483ce472053c6 in #1674, caused `make` to fail on machines where `python` is Python 3 rather than Python 2, because `dict.keys()` returns a set-like object that does not support indexing rather than a list. `date = next(iter(snaps.keys()))` would be an adequate fix too, but I’m not particularly happy with either of them, for neither would stand up to the removal of the `break` statement: one is inadequate because dictionaries are unordered collections, the other is inadequate because `current` would refer to the *last* rather than the *first* snapshot in the file. --- src/etc/dl-snapshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/dl-snapshot.py b/src/etc/dl-snapshot.py index 4399229b8..97e394fa3 100644 --- a/src/etc/dl-snapshot.py +++ b/src/etc/dl-snapshot.py @@ -31,7 +31,7 @@ with open('src/snapshots.txt') as f: # no need to look past the first section. break -date = snaps.keys()[0] +date = current triple = sys.argv[1] ts = triple.split('-') -- 2.30.2